<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>4事件修饰符</title>
        <!-- 引入Vue -->
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="demo">
            <form action="https://www.baidu.com">
            <button @click.prevent='showMsg1'>提示信息1</button>
            </form>
            <br>
            <div @click='showMsg1'>
                <button @click.stop='showMsg2'>提示信息2</button>
            </div>
            <br>
            <button @click.once='showMsg3'>提示信息3</button>
            <br>
            <br>
            <form action="https://www.baidu.com" @click='showMsg4'>
                <button @click.stop.prevent='showMsg5'>提示信息4</button>
            </form>
        </div>
    </body>

    <script type="text/javascript">
        //阻止 vue 在启动时生成生产提示。
        Vue.config.productionTip = false
        new Vue({
            el:'#demo',
            methods: {
                showMsg1(){
                    alert('prevent修饰符')
                },
                showMsg2(){
                    alert('stop修饰符')
                },
                showMsg3(){
                    alert('once修饰符')
                },
                showMsg4(){
                    alert('表单的点击事件')
                },
                showMsg5(){
                    alert('prevent,stop修饰符的串联')
                }
            }
        })
    </script>
</html>